package com.cskaoyan.gateway.controller.user;

import com.alibaba.fastjson.JSON;
import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.user.annotation.Anoymous;
import com.mall.user.intercepter.TokenIntercepter;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/user")
public class LoginOutController {

    /**
     * 登出
     * @param response
     * @return
     */
    @RequestMapping("/loginOut")
    @Anoymous
    public ResponseData loginOut(HttpServletResponse response){
        Cookie cookie = new Cookie("access_token","");
        cookie.setMaxAge(0);
        response.addCookie(cookie);
        return new ResponseUtil<>().setData(null);
    }

}
